package com.javasm.mb_store_api_final.adminLogin.login.service.Impl;


import com.javasm.mb_store_api_final.config.adminLogin.adminuser.entity.RgAdminUser;
import com.javasm.mb_store_api_final.config.adminLogin.login.entity.LoginUser;
import com.javasm.mb_store_api_final.sys_control.usercontrol.sys_user.entity.SysUser;
import com.javasm.mb_store_api_final.sys_control.usercontrol.sys_user.service.SysUserService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: xmm
 * <p>
 * &#064;@Description:
 * <p>
 * &#064;@Date 2024/7/31 下午3:25
 */
@Service("adminLoginService1")
public class AdminLoginServiceImpl  implements UserDetailsService {
    @Resource
    SysUserService adminUserService;



    @Override
    public UserDetails loadUserByUsername(String name) throws UsernameNotFoundException {
        SysUser adminUser = adminUserService.getByUsername(name);
        if (adminUser != null) {
            return new LoginUser(adminUser);
        }
        System.out.println("11111");
        return null;
    }
}
